package com.analysis.dto;

import com.analysis.entity.User;

/**
 * 登录响应DTO
 */
public class LoginResponse {
    
    private String token;
    private User user;
    private String message;
    private boolean success;
    
    public LoginResponse() {}
    
    public LoginResponse(boolean success, String message) {
        this.success = success;
        this.message = message;
    }
    
    public LoginResponse(boolean success, String message, String token, User user) {
        this.success = success;
        this.message = message;
        this.token = token;
        this.user = user;
    }
    
    public static LoginResponse success(String token, User user) {
        return new LoginResponse(true, "登录成功", token, user);
    }
    
    public static LoginResponse error(String message) {
        return new LoginResponse(false, message);
    }
    
    public String getToken() {
        return token;
    }
    
    public void setToken(String token) {
        this.token = token;
    }
    
    public User getUser() {
        return user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }
    
    public String getMessage() {
        return message;
    }
    
    public void setMessage(String message) {
        this.message = message;
    }
    
    public boolean isSuccess() {
        return success;
    }
    
    public void setSuccess(boolean success) {
        this.success = success;
    }
    
    @Override
    public String toString() {
        return "LoginResponse{" +
                "token='" + token + '\'' +
                ", user=" + user +
                ", message='" + message + '\'' +
                ", success=" + success +
                '}';
    }
}
